import React from "react";
import { useAddUserChannelMutation } from "@service/channelEndpoints";

interface Props {
  channel: Channel;
  seq: number;
}

export default function Item({ channel, seq }: Props) {
  const [addUserChannel] = useAddUserChannelMutation();
  return (
    <span
      onClick={() =>
        addUserChannel({ channels: [{ id: Number(channel.id), seq }] })
      }
      key={channel.id}
    >
      + {channel.name}
    </span>
  );
}
